﻿Imports DTO
Imports BUS


Public Class frmHoaDonBanSach
    Dim lc As Boolean = True
    Private Sub frmHoaDonBanSach_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        ' Load len tat ca cac sach co trong nha sach

        Dim dssach As DataTable = SachBUS.LayBangSach()
        ComboBox_TenSachTheLoaiTacGia.DataSource = dssach
        ComboBox_TenSachTheLoaiTacGia.DisplayMember = "TenSach"
        ComboBox_TenSachTheLoaiTacGia.ValueMember = "MaSach"
        ComboBox_TenSachTheLoaiTacGia.SelectedIndex = 0
        ' Load Tat Ca cac khach hang co so tien no khong lon hon so tien no trong quy dinh
        Dim dskhacHang As DataTable = KhachHangBUS.LayToanBoKhachHang()
        ComboBox_HoTenKhachHang.DataSource = dskhacHang
        ComboBox_HoTenKhachHang.DisplayMember = "TenKhachHang"
        ComboBox_HoTenKhachHang.ValueMember = "MaKhachHang"
        ComboBox_HoTenKhachHang.SelectedIndex = 0
        lc = True
    End Sub
    ' So Luong Chi duoc nhap so va so dó phai lon hon >0
    Private Function KiemTraDuong(ByVal n As String) As Boolean
        Try
            Dim soluong As Double = Double.Parse(n)
            If (soluong < 0) Then
                Return True
            End If
        Catch ex As Exception
            Return True

        End Try
        Return False
    End Function


    Private Sub txtSoLuong_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSoLuong.KeyPress
        Dim SoLuong As String = txtSoLuong.Text + e.KeyChar.ToString()
        If Char.IsControl(e.KeyChar) Then
            Return
        Else
            e.Handled = KiemTraDuong(SoLuong)
        End If
    End Sub





    Private Sub ComboBox_TenSach_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox_TenSachTheLoaiTacGia.SelectedIndexChanged

       

    End Sub

    Private Sub btnThem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThem.Click

    End Sub
End Class